package controle;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.swing.JOptionPane;

import modelo.Professor;

public class AlterarProfessor {

	public void alterarFuncionario(int senha, String nome, String endereco,
			int telefone, long iduser) {
		EntityManagerFactory factory = Persistence
				.createEntityManagerFactory("curso");
		EntityManager manager = factory.createEntityManager();

		manager.getTransaction().begin();

		Professor v = manager.getReference(Professor.class, iduser);

		v.setEndereco(endereco);
		v.setNome(nome);
		v.setSenha(senha);
		v.setTelefone(telefone);
		v.setIduser(iduser);

		manager.getTransaction().commit();
		factory.close();
		JOptionPane.showMessageDialog(null, "Professor Alterada com Sucesso!");
	}
}
